﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:Views1="clr-namespace:SilverlightWebcamEncoder.Views"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:SilverlightWebcamEncoder_Behaviors="clr-namespace:SilverlightWebcamEncoder.Behaviors"
             xmlns:ViewModels="clr-namespace:SilverlightWebcamEncoder.ViewModels"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:local="clr-namespace:SilverlightWebcamEncoder"
             x:Class="SilverlightWebcamEncoder.MainPage"
             mc:Ignorable="d"
             d:DesignHeight="501"
             d:DesignWidth="648"
             Width="650"
             Height="450"
             TextOptions.TextHintingMode="Animated">
    <UserControl.Resources>
        <local:BoolToVisibility x:Key="BoolToVisibility" />
        <Storyboard x:Name="LoadedAnimation">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
                                           Storyboard.TargetName="TitleTextBlockBottom">
                <DiscreteDoubleKeyFrame KeyTime="0"
                                        Value="663" />
                <EasingDoubleKeyFrame KeyTime="0:0:1"
                                      Value="0">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase EasingMode="EaseOut"
                                   Power="10" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:3"
                                      Value="0" />
                <EasingDoubleKeyFrame KeyTime="0:0:4"
                                      Value="-530">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase EasingMode="EaseOut"
                                   Power="10" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
                                           Storyboard.TargetName="TitleTextBlock">
                <EasingDoubleKeyFrame KeyTime="0"
                                      Value="-509" />
                <EasingDoubleKeyFrame KeyTime="0:0:1"
                                      Value="141">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase EasingMode="EaseOut"
                                   Power="10" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
                <EasingDoubleKeyFrame KeyTime="0:0:3"
                                      Value="141" />
                <EasingDoubleKeyFrame KeyTime="0:0:4"
                                      Value="668">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <PowerEase EasingMode="EaseOut"
                                   Power="10" />
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)"
                                           Storyboard.TargetName="EncoderView">
                <DiscreteObjectKeyFrame KeyTime="0">
                    <DiscreteObjectKeyFrame.Value>
                        <System:Boolean>True</System:Boolean>
                    </DiscreteObjectKeyFrame.Value>
                </DiscreteObjectKeyFrame>
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
    <UserControl.DataContext>
        <ViewModels:MainPageViewModel />
    </UserControl.DataContext>
    <i:Interaction.Behaviors>
        <SilverlightWebcamEncoder_Behaviors:BindableVisualStateBehavior VisualState="{Binding VisualState}" />
    </i:Interaction.Behaviors>
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <RadialGradientBrush RadiusY="0.638">
                <GradientStop Color="#FF0D0D0D"
                              Offset="1" />
                <GradientStop Color="#FF3B363A"
                              Offset="0" />
            </RadialGradientBrush>
        </Grid.Background>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="Common">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="0">
                        <VisualTransition.GeneratedEasingFunction>
                            <BounceEase EasingMode="EaseOut"
                                        Bounciness="8"
                                        Bounces="3" />
                        </VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="Encoding">
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                                       Storyboard.TargetName="EncodingTextBlock">
                            <EasingDoubleKeyFrame KeyTime="0"
                                                  Value="-100" />
                            <EasingDoubleKeyFrame KeyTime="0:0:0.5"
                                                  Value="-100" />
                            <EasingDoubleKeyFrame KeyTime="0:0:1"
                                                  Value="10">
                                <EasingDoubleKeyFrame.EasingFunction>
                                    <ElasticEase EasingMode="EaseOut"
                                                 Oscillations="2"
                                                 Springiness="6" />
                                </EasingDoubleKeyFrame.EasingFunction>
                            </EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                                       Storyboard.TargetName="PlaybackTextBlock">
                            <EasingDoubleKeyFrame KeyTime="0"
                                                  Value="10" />
                            <EasingDoubleKeyFrame KeyTime="0:0:1"
                                                  Value="10">
                                <EasingDoubleKeyFrame.EasingFunction>
                                    <PowerEase EasingMode="EaseOut"
                                               Power="4" />
                                </EasingDoubleKeyFrame.EasingFunction>
                            </EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
                                                       Storyboard.TargetName="PlaybackTextBlock">
                            <EasingDoubleKeyFrame KeyTime="0"
                                                  Value="0" />
                            <EasingDoubleKeyFrame KeyTime="0:0:1"
                                                  Value="-449">
                                <EasingDoubleKeyFrame.EasingFunction>
                                    <PowerEase EasingMode="EaseOut"
                                               Power="4" />
                                </EasingDoubleKeyFrame.EasingFunction>
                            </EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)"
                                                       Storyboard.TargetName="EncoderView">
                            <EasingDoubleKeyFrame KeyTime="0"
                                                  Value="180" />
                            <EasingDoubleKeyFrame KeyTime="0:0:1"
                                                  Value="0" >
                            	<EasingDoubleKeyFrame.EasingFunction>
                            		<ElasticEase EasingMode="EaseOut" Oscillations="1" Springiness="5"/>
                            	</EasingDoubleKeyFrame.EasingFunction>
                            </EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="EncoderView">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:0.1">
                            	<DiscreteObjectKeyFrame.Value>
                            		<Visibility>Visible</Visibility>
                            	</DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:1">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="PlaybackView">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:0.1">
                            	<DiscreteObjectKeyFrame.Value>
                            		<Visibility>Collapsed</Visibility>
                            	</DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:1">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)"
                                                       Storyboard.TargetName="PlaybackView">
                            <EasingDoubleKeyFrame KeyTime="0"
                                                  Value="0" />
                            <EasingDoubleKeyFrame KeyTime="0:0:1"
                                                  Value="-180" >
                            	<EasingDoubleKeyFrame.EasingFunction>
                            		<ElasticEase EasingMode="EaseOut" Oscillations="1" Springiness="5"/>
                            	</EasingDoubleKeyFrame.EasingFunction>
                            </EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Playback">
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"
                                                       Storyboard.TargetName="EncodingTextBlock">
                        	<SplineDoubleKeyFrame KeyTime="0"
                        		Value="0" />
                        	<SplineDoubleKeyFrame KeyTime="0:0:0.5"
                        		Value="0" />
                        	<SplineDoubleKeyFrame KeyTime="0:0:1" Value="-450"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                                       Storyboard.TargetName="EncodingTextBlock">
                        	<SplineDoubleKeyFrame KeyTime="0"
                        		Value="10" />
                        	<SplineDoubleKeyFrame KeyTime="0:0:0.5"
                        		Value="10" />
                        	<SplineDoubleKeyFrame KeyTime="0:0:1" Value="10"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)"
                                                       Storyboard.TargetName="PlaybackTextBlock">
                        	<EasingDoubleKeyFrame KeyTime="0"
                        		Value="-100" />
                        	<EasingDoubleKeyFrame KeyTime="0:0:0.5"
                        		Value="-100" />
                        	<EasingDoubleKeyFrame KeyTime="0:0:1"
                        		Value="-100" />
                        	<EasingDoubleKeyFrame KeyTime="0:0:1.5"
                        		Value="10">
                        		<EasingDoubleKeyFrame.EasingFunction>
                        			<ElasticEase EasingMode="EaseOut"
                        				Oscillations="2"
                        				Springiness="6" />
                        		</EasingDoubleKeyFrame.EasingFunction>
                        	</EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)"
                                                       Storyboard.TargetName="PlaybackView">
                        	<EasingDoubleKeyFrame KeyTime="0:0:0.5"
                        		Value="180" />
                        	<EasingDoubleKeyFrame KeyTime="0:0:1.5"
                        		Value="0" >
                        		<EasingDoubleKeyFrame.EasingFunction>
                        			<ElasticEase EasingMode="EaseOut" Oscillations="1" Springiness="5"/>
                        		</EasingDoubleKeyFrame.EasingFunction>
                        	</EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="PlaybackView">
                        	<DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Collapsed</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        	<DiscreteObjectKeyFrame KeyTime="0:0:0.6">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Visible</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        	<DiscreteObjectKeyFrame KeyTime="0:0:1.5">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Visible</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)"
                                                       Storyboard.TargetName="EncoderView">
                        	<DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Visible</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        	<DiscreteObjectKeyFrame KeyTime="0:0:0.6">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Collapsed</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        	<DiscreteObjectKeyFrame KeyTime="0:0:1.5">
                        		<DiscreteObjectKeyFrame.Value>
                        			<Visibility>Collapsed</Visibility>
                        		</DiscreteObjectKeyFrame.Value>
                        	</DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)"
                                                       Storyboard.TargetName="EncoderView">
                        	<EasingDoubleKeyFrame KeyTime="0:0:0.5"
                        		Value="0" />
                        	<EasingDoubleKeyFrame KeyTime="0:0:1.5"
                        		Value="-180" >
                        		<EasingDoubleKeyFrame.EasingFunction>
                        			<ElasticEase EasingMode="EaseOut" Oscillations="1" Springiness="5"/>
                        		</EasingDoubleKeyFrame.EasingFunction>
                        	</EasingDoubleKeyFrame>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Image Source="Resources/background.jpg"
               Stretch="Fill" />
        <TextBlock x:Name="TitleTextBlockBottom"
                   HorizontalAlignment="Left"
                   TextWrapping="Wrap"
                   VerticalAlignment="Bottom"
                   FontFamily="Segoe UI"
                   Foreground="{StaticResource CommonForegroundBrush}"
                   Text="broadcast::upload"
                   FontSize="56"
                   Margin="0"
                   Width="491"
                   RenderTransformOrigin="0.5,0.5">
        	<TextBlock.RenderTransform>
        		<CompositeTransform TranslateX="-600" />
        	</TextBlock.RenderTransform></TextBlock>
        <TextBlock x:Name="TitleTextBlock"
                   HorizontalAlignment="Left"
                   TextWrapping="Wrap"
                   VerticalAlignment="Top"
                   FontFamily="Segoe UI"
                   Foreground="{StaticResource CommonForegroundBrush}"
                   Text="webcam recorder"
                   FontSize="56"
                   Margin="0"
                   Width="491"
                   d:LayoutOverrides="HorizontalAlignment"
                   RenderTransformOrigin="0.5,0.5">
        	<TextBlock.RenderTransform>
        		<CompositeTransform TranslateX="-600" />
        	</TextBlock.RenderTransform></TextBlock>
        <TextBlock x:Name="EncodingTextBlock"
                   HorizontalAlignment="Left"
                   TextWrapping="Wrap"
                   VerticalAlignment="Top"
                   FontFamily="Segoe UI"
                   Foreground="{StaticResource CommonForegroundBrush}"
                   Text="encoding::options"
                   FontSize="56"
                   Margin="0"
                   Width="491"
                   RenderTransformOrigin="0.5,0.5">
        	<TextBlock.RenderTransform>
        		<CompositeTransform TranslateY="-100" />
        	</TextBlock.RenderTransform></TextBlock>
        <TextBlock x:Name="PlaybackTextBlock"
                   HorizontalAlignment="Left"
                   TextWrapping="Wrap"
                   VerticalAlignment="Top"
                   FontFamily="Segoe UI"
                   Foreground="{StaticResource CommonForegroundBrush}"
                   Text="playback::options"
                   FontSize="56"
                   Margin="0"
                   Width="491"
                   RenderTransformOrigin="0.5,0.5">
        	<TextBlock.RenderTransform>
        		<CompositeTransform TranslateY="-100" />
        	</TextBlock.RenderTransform></TextBlock>
        <Button x:Name="button"
                Content="Button"
                HorizontalAlignment="Right"
                VerticalAlignment="Top"
                Style="{StaticResource CloseButton}"
                Margin="0,-10,-10,0"
                Click="Button_Click"
                Background="{StaticResource CommonForegroundBrush}" />
        <Border BorderThickness="2,2,3,3"
                CornerRadius="5">
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="Black"
                                  Offset="1" />
                    <GradientStop Color="#FFAFAFAF" />
                </LinearGradientBrush>
            </Border.BorderBrush>
        </Border>
        <Grid Margin="0,50,0,0">
            <Views1:EncoderView x:Name="EncoderView"
                                IsEnabled="False">
                <Views1:EncoderView.CacheMode>
                    <BitmapCache />
                </Views1:EncoderView.CacheMode>
                <Views1:EncoderView.Projection>
                    <PlaneProjection />
                </Views1:EncoderView.Projection>
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="InjectionCompleted">
                        <ei:ControlStoryboardAction Storyboard="{StaticResource LoadedAnimation}" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </Views1:EncoderView>
            <Views1:PlaybackView x:Name="PlaybackView"
                                 HorizontalAlignment="Center"
                                 VerticalAlignment="Center"
                                 Margin="0,25,0,0"
                                 Width="457"
                                 Height="368"
                                 Visibility="Collapsed">
                <Views1:PlaybackView.Projection>
                    <PlaneProjection RotationY="-180" />
                </Views1:PlaybackView.Projection>
                <Views1:PlaybackView.CacheMode>
                    <BitmapCache />
                </Views1:PlaybackView.CacheMode>
            </Views1:PlaybackView>
        </Grid>
        <Grid x:Name="NotOOBScreen"
              Background="Black"
              Visibility="{Binding NotOutofBrowser, Converter={StaticResource BoolToVisibility}, Mode=TwoWay}">
            <StackPanel Margin="0"
                        Orientation="Vertical"
                        d:LayoutOverrides="Height"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center">
                <TextBlock TextWrapping="Wrap"
                           Text="!"
                           Foreground="White"
                           FontSize="96"
                           Margin="0"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center" />
                <TextBlock TextWrapping="Wrap"
                           Text="Application must be installed out of browser"
                           Foreground="White"
                           FontSize="18.667"
                           Margin="0"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center"
                           FontFamily="Segoe UI" />
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>
